#coding:utf-8
import urllib
import urllib2


class DxwSmsApi:
    def __init__(self):
        self.comid = 1868
        self.username = 'lovewith'
        self.password = '3f61xabc'
        self.smsnumber = '10690'

    #发送短信
    def send(self, tel, msg):
        if tel and msg:
            params = {
                'comid': self.comid,
                'username': self.username,
                'userpwd': self.password,
                'handtel': tel,
                'sendcontent': ('%s【婚礼时光】' % msg).encode('gbk'),
                'sendtime': '',
                'smsnumber': self.smsnumber
            }

            f = urllib2.urlopen('http://jiekou.56dxw.com/sms/HttpInterface.aspx?%s' % urllib.urlencode(params))
            sms_result = f.read()
            #print sms_result

if __name__ == "__main__":
    DxwSmsApi().send(18668002106, '测试')